<template>
    <div class="brokerageRuleDetail">
        <el-breadcrumb separator="/" class="bread-title">
            <el-breadcrumb-item :to="{ path: '/brokerageRuleList' }">结佣规则</el-breadcrumb-item>
            <el-breadcrumb-item v-if="type==='view'">查看</el-breadcrumb-item>
            <el-breadcrumb-item v-if="type==='edit'">编辑</el-breadcrumb-item>
        </el-breadcrumb>

        <div class="tabLook" v-if="isExceed">
            <span :class="tabIndex==0 ? 'active' : '' " @click="tabIndexclick(0)">佣金规则查看</span>
            <span :class="tabIndex==1 ? 'active' : '' " @click="tabIndexclick(1)">超标审核记录</span>
        </div>
        <!--第1个大tab 佣金规则查看编辑-->
        <div v-if="tabIndex==0">
            <h3 class="text-center pageTitle">
                {{title}}
                <div class="cesuan" @click="save(3)">
                    <div class="cesuan-img"><img src="./jisuanqi.png" alt="" width="32" height="32"></div>
                    <div>佣金测算</div>
                </div>
            </h3>
            <hr>
            <ul>
                <li>角色：{{roleFn(form.roleList)}}</li>
                <li>适用楼盘：{{allDev}}</li>
                <li>节点规则名称：{{form.nodeRuleName}}</li>
                <li>经纪人奖励：{{form.isAward==1?'有':'无'}}</li>
                <li class="returnBroke">佣金类型：{{typeFn(form.brokerageType)}}</li>

                <li v-if="type == 'view'" class="returnBroke">套餐有效期：{{$format.dateFormat(form.packageStarTime,'yyyy/MM/dd')}} 至
                    {{$format.dateFormat(form.packageEndTime,'yyyy/MM/dd')}}
                </li>
                <li v-if="type == 'edit'">
                    <el-form ref="form" :model="form" >
                        <el-form-item label="套餐有效期：" required>
                            <el-col :span="3">
                                <el-form-item prop="date1">
                                    <el-date-picker
                                            v-model="form.packageStarTime"
                                            type="date"
                                            value-format="yyyy-MM-dd"
                                            placeholder="请选择开始时间" :picker-options="pickerOption">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" style="text-align: center">至</el-col>
                            <el-col :span="3">
                                <el-form-item>
                                    <el-date-picker
                                            v-model="form.packageEndTime"
                                            type="date"
                                            value-format="yyyy-MM-dd"
                                            placeholder="请选择结束时间" :picker-options="pickerOption">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                        </el-form-item>
                    </el-form>
                </li>
            </ul>
            <hr>
            <ul>
                <li v-if="form.brokerageType == 1 || form.brokerageType == 3" class="returnBroke">
                    前佣公式：{{formulaFn(form.formulaModel[0].formula)}}
                </li>
                <li style="text-indent: 5em" class="returnBroke"
                    v-if="(form.brokerageType == 1 || form.brokerageType == 3) && (form.formulaModel[0].formula == 4 || form.formulaModel[0].formula == 5)">
                    房款税点{{form.formulaModel[0].houseMoneyTaxPoint}}% * 装修款（或其他款项）税点{{form.formulaModel[0].renovationTaxPoint}}%
                </li>
                <li v-if="form.brokerageType == 2 || form.brokerageType == 3" class="returnBroke">
                    后佣公式：{{formulaFn(form.formulaModel[is].formula)}}
                </li>
                <li style="text-indent: 5em" class="returnBroke"
                    v-if="(form.brokerageType == 2 || form.brokerageType == 3) &&
                (form.formulaModel[is].formula == 4 || form.formulaModel[is].formula == 5)">
                    *房款税点 &nbsp;&nbsp;&nbsp;&nbsp;{{form.formulaModel[is].houseMoneyTaxPoint}}
                    %&nbsp;&nbsp;&nbsp;&nbsp;*装修款（或其他款项）税点&nbsp;&nbsp;&nbsp;&nbsp;{{form.formulaModel[is].renovationTaxPoint}}%
                </li>
                <li v-if="form.isAward==1" class="returnBroke">
                    经纪人奖励公式：固定金额
                </li>
            </ul>
            <hr>

            <el-form ref="form" :model="form" label-width="140px" label-position="right" >
                <h4 style="padding-left: 40px;">{{type == 'edit' ? '请编辑佣金套餐' : '佣金套餐'}}</h4>
                <!--编辑套餐xxx-->
                <!--编辑套餐xxx-->
                <!--编辑套餐xxx-->
                <table border="1" class="el-form-item" v-if="type == 'edit'">
                    <tbody v-for="(x,index) in form.formulaPackage">
                    <tr>
                        <td rowspan="4" class="title">套餐{{alpha[index]}}</td>
                        <!--前佣-->
                        <td class="content" v-if="form.brokerageType == 1 || form.brokerageType == 3">
                            <div>前佣</div>
                            <div v-if="form.formulaModel[0].formula == 1" class="clearthis">
                                <el-form-item label="好生活总收入：" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifePackageAmount" style="width: 120px;"></el-input>
                                    元/套   *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifePercentage" style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 2" class="clearthis">
                                <el-form-item label="好生活总收入："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeProportion`" style="float: left;">
                                    含税成交价 * <el-input v-model="x.packageModel[0].goodLifeProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifePercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 3" class="clear">
                                <div>
                                    <el-form-item label="好生活总收入：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeProportion`">
                                        【含税成交价*<el-input v-model="x.packageModel[0].goodLifeProportion" style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeAmount`">
                                        <el-input v-model="x.packageModel[0].goodLifeAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[0].goodLifePercentage" style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 4" class="clearthis">
                                <el-form-item label="好生活总收入："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeProportion`" style="float: left;">
                                    不含税成交价 * <el-input v-model="x.packageModel[0].goodLifeProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifePercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 5" class="clear">
                                <div>
                                    <el-form-item label="好生活总收入：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeProportion`">
                                        【不含税成交价*<el-input v-model="x.packageModel[0].goodLifeProportion" style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeAmount`" >
                                        <el-input v-model="x.packageModel[0].goodLifeAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[0].goodLifePercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 6 || form.formulaModel[0].formula == 7" class="clearthis">
                                <el-form-item label="好生活总收入：" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifePackageAmount" style="width: 120px;"></el-input>
                                    元/平米   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifePercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifePercentage" style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <!--业绩确认节点-->
                            <p class="radios">
                                <el-form-item label="业绩确认节点：" :rules="rules.goodLifeNode" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeNode`">
                                    <el-radio-group v-model="x.packageModel[0].goodLifeNode" @change="changeNode(x,x.packageModel[0])">
                                        <el-radio :label="item.value" v-for="(item,index) in x.customeNode" :key="index">{{item.label}}</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </p>

                            <!--经纪人分佣-->
                            <div v-if="roletype!=-1">
                                <hr>
                                <div v-if="form.formulaModel[0].formula == 1" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.packageAmount`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[0].packageAmount" style="width: 120px;"></el-input>
                                        元/套   *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokeragePercentage`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[0].brokeragePercentage" style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                                <div v-if="form.formulaModel[0].formula == 2" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokerageProportion`" style="float: left;">
                                        含税成交价 * <el-input v-model="x.packageModel[0].brokerageProportion" style="width: 120px;"></el-input>
                                        %/套
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokeragePercentage`"
                                                  :rules="rules.brokerageProportion" style="float: left;">
                                        <el-input v-model="x.packageModel[0].brokeragePercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                                <div v-if="form.formulaModel[0].formula == 3" class="clear">
                                    <div>
                                        <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" style="float: left"
                                                      :rules="rules.brokerageProportion"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokerageProportion`">
                                            【含税成交价*<el-input v-model="x.packageModel[0].brokerageProportion"
                                                             style="width: 120px;"></el-input>
                                            %/套+
                                        </el-form-item>
                                        <el-form-item label="金额" style="float: left" class="clearX"
                                                      :rules="rules.brokerageAmount"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokerageAmount`">
                                            <el-input v-model="x.packageModel[0].brokerageAmount" style="width: 120px;"></el-input>
                                            元/套】
                                            *
                                        </el-form-item>
                                        <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokeragePercentage`"
                                                      :rules="rules.packageAmountPercent" style="float: left;">
                                            <el-input v-model="x.packageModel[0].brokeragePercentage"
                                                      style="width: 120px;"></el-input> %
                                        </el-form-item>
                                    </div>
                                </div>
                                <p v-if="form.formulaModel[0].formula == 4" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokerageProportion`" style="float: left;">
                                        不含税成交价 * <el-input v-model="x.packageModel[0].brokerageProportion" style="width: 120px;"></el-input>
                                        %/套
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokeragePercentage`"
                                                  :rules="rules.brokerageProportion" style="float: left;">
                                        <el-input v-model="x.packageModel[0].brokeragePercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </p>
                                <div v-if="form.formulaModel[0].formula == 5" class="clear">
                                    <div>
                                        <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" style="float: left"
                                                      :rules="rules.brokerageProportion"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokerageProportion`">
                                            【不含税成交价*<el-input v-model="x.packageModel[0].brokerageProportion"
                                                              style="width: 120px;"></el-input>
                                            %/套+
                                        </el-form-item>
                                        <el-form-item label="金额" style="float: left" class="clearX"
                                                      :rules="rules.brokerageAmount"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokerageAmount`">
                                            <el-input v-model="x.packageModel[0].brokerageAmount" style="width: 120px;"></el-input>
                                            元/套】
                                            *
                                        </el-form-item>
                                        <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokeragePercentage`"
                                                      :rules="rules.packageAmountPercent" style="float: left;">
                                            <el-input v-model="x.packageModel[0].brokeragePercentage"
                                                      style="width: 120px;"></el-input> %
                                        </el-form-item>
                                    </div>
                                </div>
                                <div v-if="form.formulaModel[0].formula == 6||form.formulaModel[0].formula == 7" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.packageAmount`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[0].packageAmount" style="width: 120px;"></el-input>
                                        元/平米   *&nbsp;
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.brokeragePercentage`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[0].brokeragePercentage" style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                                <!--节点-->
                                <div class="clear clearthat commonclass" v-for="(item,index1) in x.packageModel[0].brokerageNodes" v-if="item.nodeName != '回款'">
                                    <el-form-item :label="'节点'+(index1+1)+'：'"  style="float: left" required>
                                        {{item.nodeName}}
                                        <el-select v-model="item.brokeNodeType" placeholder="请选择" style="width: 120px;" >
                                            <el-option
                                                    v-for="item1 in options"
                                                    :key="item1.value"
                                                    :label="item1.label"
                                                    :value="item1.value">
                                            </el-option>
                                        </el-select><!-- @blur="AmountBlur(item.brokeNodeAmount)"  -->
                                        <el-input v-model="item.brokeNodeAmount" style="width: 120px;" ></el-input><em>{{item.brokeNodeType == 1 ? '%' : '元'}}</em>
                                    </el-form-item>
                                    <el-form-item style="float: left" v-if="item.nodeName == '认购'">
                                        <el-checkbox label="上限"
                                                     :true-label="1"
                                                     :false-label="2"
                                                     v-model="x.packageModel[0].packageUpperLimit" @change="clear(x.packageModel[0].packageUpperLimit,index,0)"></el-checkbox>
                                        <el-input v-model.number="item.upperLimitAmount" style="width: 120px;"
                                                  :disabled="x.packageModel[0].packageUpperLimit == 2"></el-input> 元
                                        <span class="pad grey">如果达到结佣上限，认购剩余部分佣金在下个结佣节点发放</span>
                                    </el-form-item>
                                </div>
                            </div>
                            <hr>
                            <!--好生活分佣-->
                            <div v-if="form.formulaModel[0].formula == 1" class="clearthis">
                                <el-form-item label="好生活分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifeGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 2" class="clearthis">
                                <el-form-item label="好生活分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantProportion`" style="float: left;">
                                    含税成交价 * <el-input v-model="x.packageModel[0].goodLifeGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 3" class="clear">
                                <div>
                                    <el-form-item label="好生活分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantProportion`">
                                        【含税成交价*<el-input v-model="x.packageModel[0].goodLifeGrantProportion"
                                                         style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantAmount`">
                                        <el-input v-model="x.packageModel[0].goodLifeGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[0].goodLifeGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <p v-if="form.formulaModel[0].formula == 4" class="clearthis">
                                <el-form-item label="好生活分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantProportion`" style="float: left;">
                                    不含税成交价 * <el-input v-model="x.packageModel[0].goodLifeGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </p>
                            <div v-if="form.formulaModel[0].formula == 5" class="clear">
                                <div>
                                    <el-form-item label="好生活分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantProportion`">
                                        【不含税成交价*<el-input v-model="x.packageModel[0].goodLifeGrantProportion"
                                                          style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantAmount`">
                                        <el-input v-model="x.packageModel[0].goodLifeGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[0].goodLifeGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 6||form.formulaModel[0].formula == 7" class="clearthis">
                                <el-form-item label="好生活分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifeGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/平米   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.goodLifeGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <hr>
                            <!--开发商分佣-->
                            <div v-if="form.formulaModel[0].formula == 1" class="clearthis">
                                <el-form-item label="开发商分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].openBusinessGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 2" class="clearthis">
                                <el-form-item label="开发商分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantProportion`" style="float: left;">
                                    含税成交价 * <el-input v-model="x.packageModel[0].openBusinessGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[0].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 3" class="clear">
                                <div>
                                    <el-form-item label="开发商分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantProportion`">
                                        【含税成交价*<el-input v-model="x.packageModel[0].openBusinessGrantProportion"
                                                         style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantAmount`">
                                        <el-input v-model="x.packageModel[0].openBusinessGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *

                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[0].openBusinessGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <p v-if="form.formulaModel[0].formula == 4" class="clearthis">
                                <el-form-item label="开发商分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantProportion`" style="float: left;">
                                    不含税成交价 * <el-input v-model="x.packageModel[0].openBusinessGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[0].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </p>
                            <div v-if="form.formulaModel[0].formula == 5" class="clear">
                                <div>
                                    <el-form-item label="开发商分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantProportion`">
                                        【不含税成交价*<el-input v-model="x.packageModel[0].openBusinessGrantProportion"
                                                          style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantAmount`">
                                        <el-input v-model="x.packageModel[0].openBusinessGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[0].openBusinessGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <div v-if="form.formulaModel[0].formula == 6||form.formulaModel[0].formula == 7" class="clearthis">
                                <el-form-item label="开发商分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].openBusinessGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/平米   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + 0 + `.openBusinessGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[0].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                        </td>
                        <td rowspan="4" class="title">
                            <el-button type="primary" @click="del(index)" v-if="index > 0">删除</el-button>
                        </td>
                    </tr>
                    <tr>
                        <!--后-->
                        <td class="content" v-if="form.brokerageType == 2 || form.brokerageType == 3">
                            <div>后佣</div>
                            <div v-if="form.formulaModel[is].formula == 1" class="clearthis">

                                <el-form-item label="好生活总收入：" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifePackageAmount" style="width: 120px;"></el-input>
                                    元/套 *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifePercentage" style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[is].formula == 2" class="clearthis">
                                <el-form-item label="好生活总收入："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeProportion`" style="float: left;">
                                    含税成交价*<el-input v-model="x.packageModel[is].goodLifeProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifePercentage" style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <div v-if="form.formulaModel[is].formula == 3" class="clear">
                                <div>
                                    <el-form-item label="好生活总收入：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeProportion`">
                                        【含税成交价*<el-input v-model="x.packageModel[is].goodLifeProportion" style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeAmount`">
                                        <el-input v-model="x.packageModel[is].goodLifeAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[is].goodLifePercentage" style="width: 120px;"></el-input> %
                                    </el-form-item>

                                </div>
                            </div>
                            <div v-if="form.formulaModel[is].formula == 4" class="clearthis">
                                <el-form-item label="好生活总收入："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeProportion`" style="float: left;">
                                    不含税成交价 * <el-input v-model="x.packageModel[is].goodLifeProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifePercentage" style="width: 120px;"></el-input> %
                                </el-form-item>

                            </div>
                            <div v-if="form.formulaModel[is].formula == 5" >
                                <div class="clear">
                                    <el-form-item label="好生活总收入：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeProportion`">
                                        【不含税成交价*<el-input v-model="x.packageModel[is].goodLifeProportion" style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeAmount`">
                                        <el-input v-model="x.packageModel[is].goodLifeAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[is].goodLifePercentage" style="width: 120px;"></el-input> %
                                    </el-form-item>

                                </div>
                            </div>
                            <div v-if="form.formulaModel[is].formula == 6||form.formulaModel[is].formula == 7" class="clearthis">

                                <el-form-item label="好生活总收入：" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifePackageAmount" style="width: 120px;"></el-input>
                                    元/平米 *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifePercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifePercentage" style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <!--业绩确认节点-->
                            <p class="radios">
                                <el-form-item label="业绩确认节点：" :rules="rules.goodLifeNode" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeNode`">

                                    <el-radio-group v-model="x.packageModel[is].goodLifeNode" @change="changeNode(x,x.packageModel[is])">
                                        <el-radio :label="item.value" v-for="(item,index) in x.customeNode" :key="index">{{item.label}}</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </p>

                            <!--经纪人分佣-->
                            <div v-if="roletype!=-1">
                                <hr>
                                <div v-if="form.formulaModel[is].formula == 1" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.packageAmount`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[is].packageAmount" style="width: 120px;"></el-input>
                                        元/套   *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokeragePercentage`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[is].brokeragePercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                                <p v-if="form.formulaModel[is].formula == 2" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokerageProportion`" style="float: left;">
                                        含税成交价*<el-input v-model="x.packageModel[is].brokerageProportion" style="width: 120px;"></el-input>
                                        %/套
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokeragePercentage`"
                                                  :rules="rules.brokerageProportion" style="float: left;">
                                        <el-input v-model="x.packageModel[is].brokeragePercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </p>
                                <div v-if="form.formulaModel[is].formula == 3" class="clear">
                                    <div>
                                        <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" style="float: left"
                                                      :rules="rules.brokerageProportion"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokerageProportion`">
                                            【含税成交价*<el-input v-model="x.packageModel[is].brokerageProportion"
                                                             style="width: 120px;"></el-input>
                                            %/套+
                                        </el-form-item>
                                        <el-form-item label="金额" style="float: left" class="clearX"
                                                      :rules="rules.brokerageAmount"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokerageAmount`">
                                            <el-input v-model="x.packageModel[is].brokerageAmount" style="width: 120px;"></el-input>
                                            元/套】
                                            *
                                        </el-form-item>
                                        <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokeragePercentage`"
                                                      :rules="rules.packageAmountPercent" style="float: left;">
                                            <el-input v-model="x.packageModel[is].brokeragePercentage"
                                                      style="width: 120px;"></el-input> %
                                        </el-form-item>
                                    </div>
                                </div>
                                <p v-if="form.formulaModel[is].formula == 4" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokerageProportion`" style="float: left;">
                                        不含税成交价 * <el-input v-model="x.packageModel[is].brokerageProportion" style="width: 120px;"></el-input>
                                        %/套
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokeragePercentage`"
                                                  :rules="rules.brokerageProportion" style="float: left;">
                                        <el-input v-model="x.packageModel[is].brokeragePercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </p>
                                <div v-if="form.formulaModel[is].formula == 5" class="clear">
                                    <div>
                                        <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" style="float: left"
                                                      :rules="rules.brokerageProportion"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokerageProportion`">
                                            【不含税成交价*<el-input v-model="x.packageModel[is].brokerageProportion" style="width: 120px;"></el-input>
                                            %/套+
                                        </el-form-item>
                                        <el-form-item label="金额" style="float: left" class="clearX"
                                                      :rules="rules.brokerageAmount"
                                                      :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokerageAmount`">
                                            <el-input v-model="x.packageModel[is].brokerageAmount" style="width: 120px;"></el-input>
                                            元/套】
                                            *
                                        </el-form-item>
                                        <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokeragePercentage`"
                                                      :rules="rules.packageAmountPercent" style="float: left;">
                                            <el-input v-model="x.packageModel[is].brokeragePercentage"
                                                      style="width: 120px;"></el-input> %
                                        </el-form-item>
                                    </div>
                                </div>
                                <div v-if="form.formulaModel[is].formula == 6||form.formulaModel[is].formula == 7" class="clearthis">
                                    <el-form-item :label="form.roleList[0] == 3?'经纪人分佣：':'网络推客分佣：'" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.packageAmount`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[is].packageAmount" style="width: 120px;"></el-input>
                                        元/平米   *&nbsp;
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.brokeragePercentage`"
                                                  :rules="rules.packageAmount" style="float: left;">
                                        <el-input v-model="x.packageModel[is].brokeragePercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                                <!--节点-->
                                <div class="clear clearthat commonclass" v-for="(item,index1) in x.packageModel[is].brokerageNodes">
                                    <el-form-item :label="'节点'+(index1+1)+'：'"  style="float: left" required>
                                        {{item.nodeName}}
                                        <el-select v-model="item.brokeNodeType" placeholder="请选择" style="width: 120px;" v-if="item.nodeName != '回款'">
                                            <el-option
                                                    v-for="item1 in options"
                                                    :key="item1.value"
                                                    :label="item1.label"
                                                    :value="item1.value">
                                            </el-option>
                                        </el-select><!-- @blur="AmountBlur(item.brokeNodeAmount)" -->
                                        <el-input v-model="item.brokeNodeAmount" style="width: 120px;"  v-if="item.nodeName != '回款'"></el-input><em v-if="item.nodeName != '回款'">{{item.brokeNodeType == 1 ? '%' : '元'}}</em>
                                    </el-form-item>
                                    <el-form-item style="float: left" v-if="item.nodeName == '认购'">
                                        <el-checkbox label="上限"
                                                     :true-label="1"
                                                     :false-label="2"
                                                     v-model="x.packageModel[is].packageUpperLimit" @change="clear(x.packageModel[is].packageUpperLimit,index,1)"></el-checkbox>
                                        <el-input v-model.number="item.upperLimitAmount" style="width: 120px;"
                                                  :disabled="x.packageModel[is].packageUpperLimit == 2"></el-input> 元
                                        <span class="pad grey">如果达到结佣上限，认购剩余部分佣金在下个结佣节点发放</span>
                                    </el-form-item>
                                </div>
                            </div>

                            <!--好生活分佣-->
                            <div v-if="form.formulaModel[is].formula == 1" class="clearthis">
                                <el-form-item label="好生活分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifeGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套   *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <p v-if="form.formulaModel[is].formula== 2" class="clearthis">
                                <el-form-item label="好生活分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantProportion`" style="float: left;">
                                    含税成交价*<el-input v-model="x.packageModel[is].goodLifeGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </p>
                            <div v-if="form.formulaModel[is].formula == 3" class="clear">
                                <div>
                                    <el-form-item label="好生活分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantProportion`">
                                        【含税成交价*<el-input v-model="x.packageModel[is].goodLifeGrantProportion"
                                                         style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantAmount`">
                                        <el-input v-model="x.packageModel[is].goodLifeGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *

                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[is].goodLifeGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <p v-if="form.formulaModel[is].formula == 4" class="clearthis">
                                <el-form-item label="好生活分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantProportion`" style="float: left;">
                                    不含税成交价 * <el-input v-model="x.packageModel[is].goodLifeGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </p>
                            <div v-if="form.formulaModel[is].formula == 5" class="clear">
                                <div>
                                    <el-form-item label="好生活分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantProportion`">
                                        【不含税成交价*<el-input v-model="x.packageModel[is].goodLifeGrantProportion" style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantAmount`">
                                        <el-input v-model="x.packageModel[is].goodLifeGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[is].goodLifeGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <div v-if="form.formulaModel[is].formula == 6||form.formulaModel[is].formula == 7" class="clearthis">
                                <el-form-item label="好生活分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifeGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/平米   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.goodLifeGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].goodLifeGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <!--开发商分佣-->
                            <div v-if="form.formulaModel[is].formula == 1" class="clearthis">
                                <el-form-item label="开发商分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].openBusinessGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                            <p v-if="form.formulaModel[is].formula == 2" class="clearthis">
                                <el-form-item label="开发商分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantProportion`" style="float: left;">
                                    含税成交价*<el-input v-model="x.packageModel[is].openBusinessGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[is].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </p>
                            <div v-if="form.formulaModel[is].formula == 3" class="clear">
                                <div>
                                    <el-form-item label="开发商分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantProportion`">
                                        【含税成交价*<el-input v-model="x.packageModel[is].openBusinessGrantProportion"
                                                         style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantAmount`">
                                        <el-input v-model="x.packageModel[is].openBusinessGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[is].openBusinessGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <p v-if="form.formulaModel[is].formula == 4" class="clearthis">
                                <el-form-item label="开发商分佣："
                                              :rules="rules.brokerageProportion"
                                              :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantProportion`" style="float: left;">
                                    不含税成交价 * <el-input v-model="x.packageModel[is].openBusinessGrantProportion" style="width: 120px;"></el-input>
                                    %/套
                                    *
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPercentage`"
                                              :rules="rules.brokerageProportion" style="float: left;">
                                    <el-input v-model="x.packageModel[is].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </p>
                            <div v-if="form.formulaModel[is].formula == 5" class="clear">
                                <div>
                                    <el-form-item label="开发商分佣：" style="float: left"
                                                  :rules="rules.brokerageProportion"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantProportion`">
                                        【不含税成交价*<el-input v-model="x.packageModel[is].openBusinessGrantProportion"
                                                          style="width: 120px;"></el-input>
                                        %/套+
                                    </el-form-item>
                                    <el-form-item label="金额" style="float: left" class="clearX"
                                                  :rules="rules.brokerageAmount"
                                                  :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantAmount`">
                                        <el-input v-model="x.packageModel[is].openBusinessGrantAmount" style="width: 120px;"></el-input>
                                        元/套】
                                        *
                                    </el-form-item>
                                    <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPercentage`"
                                                  :rules="rules.packageAmountPercent" style="float: left;">
                                        <el-input v-model="x.packageModel[is].openBusinessGrantPercentage"
                                                  style="width: 120px;"></el-input> %
                                    </el-form-item>
                                </div>
                            </div>
                            <div v-if="form.formulaModel[is].formula == 6||form.formulaModel[is].formula == 7" class="clearthis">
                                <el-form-item label="开发商分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPackageAmount`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].openBusinessGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/平米   *&nbsp;
                                </el-form-item>
                                <el-form-item label="" label-width="0" :prop="`formulaPackage.` + index + `.packageModel.` + is + `.openBusinessGrantPercentage`"
                                              :rules="rules.packageAmount" style="float: left;">
                                    <el-input v-model="x.packageModel[is].openBusinessGrantPercentage"
                                              style="width: 120px;"></el-input> %
                                </el-form-item>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="content" v-if="form.roleList[0] == 3 && form.isAward == 1">
                            <div>经纪人奖励</div>
                            <div>
                                <el-form-item label="奖励来源：" :rules="rules.awardSource" :prop="`formulaPackage.` + index + `.packageModel.` + (is+1) + `.awardSource`">
                                    <el-select v-model="x.packageModel[is+1].awardSource">
                                        <el-option v-for="item in awardSources" :label="item.label" :value="item.value" :key="item.label"></el-option>
                                    </el-select>
                                </el-form-item>
                            </div>
                            <div>
                                <el-form-item label="奖励方式：" :rules="rules.awardType" :prop="`formulaPackage.` + index + `.packageModel.` + (is+1) + `.awardType`">
                                    <el-select v-model="x.packageModel[is+1].awardType">
                                        <el-option v-for="item in awardTypes" :label="item.label" :value="item.value" :key="item.label"></el-option>
                                    </el-select>
                                </el-form-item>
                            </div>
                            <hr/>

                            <div>
                                <el-form-item :label="x.packageModel[is+1].awardSource==2?'好生活总收入':'经纪人奖励合计：'" :prop="`formulaPackage.` + index + `.packageModel.` + (is+1) + `.goodLifePackageAmount`"
                                              :rules="rules.packageAmount">
                                    <el-input v-model.trim="x.packageModel[is+1].goodLifePackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套<span style="padding-left: 20px; color: #888;">注：{{x.packageModel[is+1].awardSource==2?'好生活总收入':'经纪人奖励合计：'}}=经纪人奖励+好生活分佣+开发商分佣</span>
                                </el-form-item>
                            </div>
                            <p class="radios">
                                <el-form-item label="业绩确认节点：" :rules="rules.goodLifeNode" :prop="`formulaPackage.` + index + `.packageModel.` + (is+1) + `.goodLifeNode`">

                                    <el-radio-group v-model="x.packageModel[is+1].goodLifeNode" @change="changeNode(x,x.packageModel[is+1])">
                                        <el-radio :label="item.value" v-for="(item,index) in x.customeNode" :key="index">{{item.label}}</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </p>
                            <hr>

                            <div>
                                <el-form-item label="经纪人奖励：" :prop="`formulaPackage.` + index + `.packageModel.` + (is+1) + `.packageAmount`"
                                              :rules="rules.packageAmount" >
                                    <el-input v-model.trim="x.packageModel[is+1].packageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套
                                </el-form-item>
                            </div>
                            <!--节点-->
                            <div class="clear clearthat commonclass" v-for="(item,index1) in x.packageModel[is+1].brokerageNodes">
                                <el-form-item :label="'节点'+(index1+1)+'：'" class="commonclass">
                                    {{item.nodeName}}
                                    <el-input v-model.trim="item.brokeNodeAmount" style="width: 120px;"></el-input>元/套
                                </el-form-item>
                            </div>
                            <hr>

                            <div>
                                <el-form-item label="好生活分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + (is+1) + `.goodLifeGrantPackageAmount`"
                                              :rules="rules.packageAmount">
                                    <el-input v-model.trim="x.packageModel[is+1].goodLifeGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套
                                </el-form-item>
                            </div>
                            <div>
                                <el-form-item label="开发商分佣：" :prop="`formulaPackage.` + index + `.packageModel.` + (is+1) + `.openBusinessGrantPackageAmount`"
                                              :rules="rules.packageAmount">
                                    <el-input v-model.trim="x.packageModel[is+1].openBusinessGrantPackageAmount"
                                              style="width: 120px;"></el-input>
                                    元/套
                                </el-form-item>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="content">
                            <div class="pad red">
                                预计总佣金=
                                <span v-if="form.brokerageType == 1 || form.brokerageType == 3">{{hehe(form.brokerageType,form.formulaModel[0].formula,x.packageModel[0])}}</span>
                                <span v-if="form.brokerageType == 3"> + </span>
                                <span v-if="form.brokerageType == 2 || form.brokerageType == 3">{{hehe(form.brokerageType,form.formulaModel[is].formula,x.packageModel[is])}}</span>
                                <span v-if="form.roleList[0] == 3 && form.isAward == 1"> + </span>
                                <span v-if="form.roleList[0] == 3 && form.isAward == 1">{{x.packageModel[is+1].goodLifePackageAmount}}元/套</span>
                            </div>
                            <div>
                                <el-form-item label="套餐名称："
                                              :rules="rules.packageName"
                                              :prop="`formulaPackage.` + index + `.packageName`">

                                    <el-input v-model="x.packageName" style="width: 620px;" :maxlength="50"></el-input>
                                    <span class="grey pad">请录入能够吸引经纪人的套餐名称，如7%垫佣</span>
                                </el-form-item>
                            </div>
                            <div>
                                <el-form-item label="套餐说明："
                                              :rules="rules.packageExplain"
                                              :prop="`formulaPackage.` + index + `.packageExplain`">

                                    <el-input v-model="x.packageExplain" style="width: 620px;" :maxlength="200" type="textarea" :rows="4"></el-input>
                                    <span class="grey pad">请录入能够吸引经纪人的套餐说明，如以月为单位跳点结佣<br>
                                            还可以再输入{{200-x.packageExplain.length}}
                                        </span>
                                </el-form-item>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!--查看套餐xxx-->
                <!--查看套餐xxx-->
                <!--查看套餐xxx-->
                <table border="1" class="el-form-item" v-if="type == 'view'">
                    <tbody v-for="(x,index) in form.formulaPackage">
                    <tr>
                        <td rowspan="4" class="title">套餐{{alpha[index]}}</td>
                        <!--前佣-->
                        <td class="content" v-if="form.brokerageType == 1 || form.brokerageType == 3">
                            <p>前佣</p>
                            <!--好生活总收入-->
                            <p v-if="form.formulaModel[0].formula == 1">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">{{x.packageModel[0].goodLifePackageAmount}}元/套</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifePercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 2">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">含税成交价*{{x.packageModel[0].goodLifeProportion}}%/套</span>
                                <span>* {{x.packageModel[0].goodLifePercentage}}%</span>
                            </p>

                            <p v-if="form.formulaModel[0].formula == 3">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">含税成交价*{{x.packageModel[0].goodLifeProportion}}%/套</span>
                                <span class="pad">+ 金额{{x.packageModel[0].goodLifeAmount}}元/套】</span>
                                <span>*{{x.packageModel[0].goodLifePercentage}}%</span>
                            </p>

                            <p v-if="form.formulaModel[0].formula == 4">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">不含税成交价</span>
                                <span class="pad">*{{x.packageModel[0].goodLifeProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifePercentage}}%</span>
                            </p>

                            <p v-if="form.formulaModel[0].formula == 5">
                                <span class="pad returnBroke">不含税成交价:</span>
                                <span class="pad">*{{x.packageModel[0].goodLifeProportion}}%/套</span>
                                <span class="pad">+ 金额{{x.packageModel[0].goodLifeAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifePercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 6||form.formulaModel[0].formula == 7">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">{{x.packageModel[0].goodLifePackageAmount}}元/平米</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifePercentage}}%</span>
                            </p>
                            <p>
                                <span class="pad returnBroke">业绩确认节点：</span>
                                <span class="pad">{{x.packageModel[0].goodLifeNodeName}}</span>
                            </p>

                            <!--经纪人分佣-->
                            <div v-if="roletype!=-1">
                                <hr>
                                <p v-if="form.formulaModel[0].formula == 1">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">{{x.packageModel[0].packageAmount}}元/套</span>
                                    <span class="pad1">*{{x.packageModel[0].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[0].formula == 2">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">含税成交价 * {{x.packageModel[0].brokerageProportion}}%/套</span>
                                    <span class="pad1">*{{x.packageModel[0].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[0].formula == 3">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">含税成交价 * {{x.packageModel[0].brokerageProportion}}%/套+</span>
                                    <span class="pad">金额{{x.packageModel[0].brokerageAmount}}元/套】</span>
                                    <span class="pad1">*{{x.packageModel[0].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[0].formula == 4">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">不含税成交价 * {{x.packageModel[0].brokerageProportion}}%/套</span>
                                    <span class="pad1">*{{x.packageModel[0].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[0].formula == 5">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">不含税成交价 * {{x.packageModel[0].brokerageProportion}}%/套+</span>
                                    <span class="pad">金额{{x.packageModel[0].brokerageAmount}}元/套】</span>
                                    <span class="pad1">*{{x.packageModel[0].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[0].formula == 6||form.formulaModel[0].formula == 7">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">{{x.packageModel[0].packageAmount}}元/平米</span>
                                    <span class="pad1">*{{x.packageModel[0].brokeragePercentage}}%</span>
                                </p>
                                <!--节点-->
                                <p v-for="(item,index) in x.packageModel[0].brokerageNodes" style="margin-left: 70px" class="returnBroke"  v-if="item.nodeName != '回款'">
                                    <span>节点{{index+1}}：</span> <span style="margin-left: 15px" >{{item.nodeName}}</span>
                                    <span v-if="item.brokeNodeType == 1" style="margin-left: 25px;">{{item.brokeNodeAmount}}%</span>
                                    <span v-if="item.brokeNodeType == 2 " style="margin-left: 25px;">{{item.brokeNodeAmount}}元</span>
                                    <span style="margin-left: 50px;" v-if="item.upperLimitAmount">上限：{{item.upperLimitAmount}}元</span>
                                </p>
                            </div>
                            <hr>
                            <!--好生活分佣-->
                            <p v-if="form.formulaModel[0].formula == 1">
                                <span class="pad returnBroke">好生活分佣:</span>
                                <span class="pad">{{x.packageModel[0].goodLifeGrantPackageAmount}}</span>
                                <span class="pad">元/套*</span>
                                <span class="pad1">{{x.packageModel[0].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 2">
                                <span class="pad returnBroke">好生活分佣:</span>
                                <span class="pad">含税成交价 * {{x.packageModel[0].goodLifeGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 3">
                                <span class="pad returnBroke">好生活分佣:</span>
                                <span class="pad">含税成交价 * {{x.packageModel[0].goodLifeGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[0].goodLifeGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 4">
                                <span class="pad returnBroke">好生活分佣:</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[0].goodLifeGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 5">
                                <span class="pad returnBroke">好生活分佣:</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[0].goodLifeGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[0].goodLifeGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[0].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 6||form.formulaModel[0].formula == 7">
                                <span class="pad returnBroke">好生活分佣:</span>
                                <span class="pad">{{x.packageModel[0].goodLifeGrantPackageAmount}}</span>
                                <span class="pad">元/平米 &nbsp; * &nbsp;</span>
                                <span class="pad1">{{x.packageModel[0].goodLifeGrantPercentage}}%</span>
                            </p>
                            <hr>
                            <!--开发商分佣-->
                            <p v-if="form.formulaModel[0].formula == 1">
                                <span class="pad returnBroke">开发商分佣:</span>
                                <span class="pad">{{x.packageModel[0].openBusinessGrantPackageAmount}}元/套</span>
                                <span class="pad1">*{{x.packageModel[0].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 2">
                                <span class="pad returnBroke">开发商分佣:</span>
                                <span class="pad">含税成交价 * {{x.packageModel[0].openBusinessGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[0].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 3">
                                <span class="pad returnBroke">开发商分佣:</span>
                                <span class="pad">含税成交价 * {{x.packageModel[0].openBusinessGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[0].openBusinessGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[0].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 4">
                                <span class="pad returnBroke">开发商分佣:</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[0].openBusinessGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[0].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 5">
                                <span class="pad returnBroke">开发商分佣:</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[0].openBusinessGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[0].openBusinessGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[0].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[0].formula == 6||form.formulaModel[0].formula == 7">
                                <span class="pad returnBroke">开发商分佣:</span>
                                <span class="pad">{{x.packageModel[0].openBusinessGrantPackageAmount}}元/平米</span>
                                <span class="pad1">*{{x.packageModel[0].openBusinessGrantPercentage}}%</span>
                            </p>
                        </td>
                    </tr>
                    <tr>
                        <!--后佣-->
                        <td class="content" v-if="form.brokerageType == 2 || form.brokerageType == 3">
                            <p>后佣</p>
                            <!--好生活总收入-->
                            <p v-if="form.formulaModel[is].formula == 1">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">{{x.packageModel[is].goodLifePackageAmount}}元/套</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifePercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 2">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">含税成交价*{{x.packageModel[is].goodLifeProportion}}%/套</span>
                                <span>* {{x.packageModel[is].goodLifePercentage}}%</span>
                            </p>

                            <p v-if="form.formulaModel[is].formula == 3">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">含税成交价*{{x.packageModel[is].goodLifeProportion}}%/套</span>
                                <span class="pad">+ 金额{{x.packageModel[is].goodLifeAmount}}元/套】</span>
                                <span>*{{x.packageModel[is].goodLifePercentage}}%</span>
                            </p>

                            <p v-if="form.formulaModel[is].formula == 4">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">不含税成交价</span>
                                <span class="pad">*{{x.packageModel[is].goodLifeProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifePercentage}}%</span>
                            </p>

                            <p v-if="form.formulaModel[is].formula == 5">
                                <span class="pad returnBroke">不含税成交价:</span>
                                <span class="pad">*{{x.packageModel[is].goodLifeProportion}}%/套</span>
                                <span class="pad">+ 金额{{x.packageModel[is].goodLifeAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifePercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 6 || form.formulaModel[is].formula == 7">
                                <span class="pad returnBroke">好生活总收入:</span>
                                <span class="pad">{{x.packageModel[is].goodLifePackageAmount}}元/平米</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifePercentage}}%</span>
                            </p>
                            <p>
                                <span class="pad returnBroke">业绩确认节点:</span>
                                <span class="pad">{{x.packageModel[is].goodLifeNodeName}}</span>
                            </p>

                            <!--经纪人分佣-->
                            <div v-if="roletype!=-1">
                                <hr>
                                <p v-if="form.formulaModel[is].formula == 1">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">{{x.packageModel[is].packageAmount}}元/套</span>
                                    <span class="pad1">*{{x.packageModel[is].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[is].formula == 2">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">含税成交价 * {{x.packageModel[is].brokerageProportion}}%/套</span>
                                    <span class="pad1">*{{x.packageModel[is].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[is].formula == 3">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">含税成交价 * {{x.packageModel[is].brokerageProportion}}%/套+</span>
                                    <span class="pad">金额{{x.packageModel[is].brokerageAmount}}元/套】</span>
                                    <span class="pad1">*{{x.packageModel[is].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[is].formula == 4">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">不含税成交价 * {{x.packageModel[is].brokerageProportion}}%/套</span>
                                    <span class="pad1">*{{x.packageModel[is].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[is].formula == 5">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">不含税成交价 * {{x.packageModel[is].brokerageProportion}}%/套+</span>
                                    <span class="pad">金额{{x.packageModel[is].brokerageAmount}}元/套】</span>
                                    <span class="pad1">*{{x.packageModel[is].brokeragePercentage}}%</span>
                                </p>
                                <p v-if="form.formulaModel[is].formula == 6||form.formulaModel[is].formula == 7">
                                    <span class="pad returnBroke" v-if="form.roleList == 3">经纪人分佣</span>
                                    <span class="pad returnBroke" v-else>网络推客分佣</span>
                                    <span class="pad">{{x.packageModel[is].packageAmount}}元/平米</span>
                                    <span class="pad1">*{{x.packageModel[is].brokeragePercentage}}%</span>
                                </p>
                                <!--节点-->
                                <p v-for="(item,index) in x.packageModel[is].brokerageNodes" style="margin-left: 70px" class="returnBroke">
                                    节点{{index+1}}： <span style="margin-left: 15px" >{{item.nodeName}}</span>
                                    <span v-if="item.brokeNodeType == 1 && item.nodeName != '回款'" style="margin-left: 25px;">{{item.brokeNodeAmount}}%</span>
                                    <span v-if="item.brokeNodeType == 2 && item.nodeName != '回款'" style="margin-left: 25px;">{{item.brokeNodeAmount}}元</span>
                                    <span style="margin-left: 50px;" v-if="item.upperLimitAmount">上限：{{item.upperLimitAmount}}元</span>
                                </p>
                            </div>

                            <hr>
                            <!--好生活分佣-->
                            <p v-if="form.formulaModel[is].formula == 1">
                                <span class="pad returnBroke">好生活分佣</span>
                                <span class="pad">{{x.packageModel[is].goodLifeGrantPackageAmount}}</span>
                                <span class="pad">元/套*</span>
                                <span class="pad1">{{x.packageModel[is].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 2">
                                <span class="pad returnBroke">好生活分佣</span>
                                <span class="pad">含税成交价 * {{x.packageModel[is].goodLifeGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 3">
                                <span class="pad returnBroke">好生活分佣</span>
                                <span class="pad">含税成交价 * {{x.packageModel[is].goodLifeGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[is].goodLifeGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 4">
                                <span class="pad returnBroke">好生活分佣</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[is].goodLifeGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 5">
                                <span class="pad returnBroke">好生活分佣</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[is].goodLifeGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[is].goodLifeGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[is].goodLifeGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 6||form.formulaModel[is].formula == 7">
                                <span class="pad returnBroke">好生活分佣</span>
                                <span class="pad">{{x.packageModel[is].goodLifeGrantPackageAmount}}</span>
                                <span class="pad">元/平米&nbsp; * &nbsp;</span>
                                <span class="pad1">{{x.packageModel[is].goodLifeGrantPercentage}}%</span>
                            </p>

                            <hr>
                            <!--开发商分佣-->
                            <p v-if="form.formulaModel[is].formula == 1">
                                <span class="pad returnBroke">开发商分佣</span>
                                <span class="pad">{{x.packageModel[is].openBusinessGrantPackageAmount}}元/套</span>
                                <span class="pad1">*{{x.packageModel[is].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 2">
                                <span class="pad returnBroke">开发商分佣</span>
                                <span class="pad">含税成交价 * {{x.packageModel[is].openBusinessGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[is].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 3">
                                <span class="pad returnBroke">开发商分佣</span>
                                <span class="pad">含税成交价 * {{x.packageModel[is].openBusinessGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[is].openBusinessGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[is].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 4">
                                <span class="pad returnBroke">开发商分佣</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[is].openBusinessGrantProportion}}%/套</span>
                                <span class="pad1">*{{x.packageModel[is].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 5">
                                <span class="pad returnBroke">开发商分佣</span>
                                <span class="pad">不含税成交价 * {{x.packageModel[is].openBusinessGrantProportion}}%/套</span>
                                <span class="pad">+金额{{x.packageModel[is].openBusinessGrantAmount}}元/套】</span>
                                <span class="pad1">*{{x.packageModel[is].openBusinessGrantPercentage}}%</span>
                            </p>
                            <p v-if="form.formulaModel[is].formula == 6||form.formulaModel[is].formula == 7">
                                <span class="pad returnBroke">开发商分佣</span>
                                <span class="pad">{{x.packageModel[is].openBusinessGrantPackageAmount}}元/平米</span>
                                <span class="pad1">*{{x.packageModel[is].openBusinessGrantPercentage}}%</span>
                            </p>

                        </td>
                    </tr>
                    <tr>
                        <!--经纪人奖励-->
                        <td class="content" v-if="form.roleList[0] == 3 && form.isAward == 1">
                            <p>经纪人奖励</p>
                            <p>
                                <span class="pad returnBroke">奖励来源：</span>
                                <span class="pad">{{awardSourcefrom(x.packageModel[is+1].awardSource)}}</span>
                            </p>
                            <p>
                                <span class="pad returnBroke">奖励方式：</span>
                                <span class="pad">{{awardTypeway(x.packageModel[is+1].awardType)}}</span>
                            </p>
                            <hr/>

                            <p v-if="form.formulaModel[is+1].formula == 1">
                                <span class="pad returnBroke">{{x.packageModel[is+1].awardSource==2?'好生活总收入：':'经纪人奖励合计：'}}</span>
                                <span class="pad">{{x.packageModel[is+1].goodLifePackageAmount}}元/套</span>
                            </p>
                            <p>
                                <span class="pad returnBroke">业绩确认节点：</span>
                                <span class="pad">{{x.packageModel[is+1].goodLifeNodeName}}</span>
                            </p>

                            <hr>
                            <p>
                                <span class="pad returnBroke">经纪人奖励：</span>
                                <span class="pad">{{x.packageModel[is+1].packageAmount}}元/套</span>
                            </p>
                            <p v-for="(item,index) in x.packageModel[is+1].brokerageNodes" style="margin-left: 70px" class="returnBroke">
                                节点{{index+1}}： <span style="margin-left: 15px" >{{item.nodeName}}</span>
                                <span style="margin-left: 15px" >{{item.brokeNodeAmount}}元/套</span>
                            </p>
                            <hr>
                            <p>
                                <span class="pad returnBroke">好生活分佣：</span>
                                <span class="pad">{{x.packageModel[is+1].goodLifeGrantPackageAmount}}元/套</span>
                            </p>
                            <hr/>
                            <p>
                                <span class="pad returnBroke">开发商分佣：</span>
                                <span class="pad">{{x.packageModel[is+1].openBusinessGrantPackageAmount}}元/套</span>
                            </p>
                        </td>
                    </tr>
                    <tr>
                        <td class="content">
                            <p class="pad red">
                                预计总佣金=
                                <span v-if="form.brokerageType == 1 || form.brokerageType == 3">{{hehe(form.brokerageType,form.formulaModel[0].formula,x.packageModel[0])}}</span>
                                <span v-if="form.brokerageType == 3"> + </span>
                                <span v-if="form.brokerageType == 2 || form.brokerageType == 3">{{hehe(form.brokerageType,form.formulaModel[is].formula,x.packageModel[is])}}</span>
                                <span v-if="form.roleList[0] == 3 && form.isAward == 1"> + </span>
                                <span v-if="form.roleList[0] == 3 && form.isAward == 1">{{x.packageModel[is+1].goodLifePackageAmount}}元/套</span>
                            </p>

                            <p class="returnBroke">
                                套餐名称：{{x.packageName}}
                            </p>
                            <p class="returnBroke">
                                套餐说明：{{x.packageExplain}}
                            </p>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <el-button type="primary" @click="addTc" v-if="type == 'edit'">增加</el-button>
                <div class="hint el-form-item">
                    <p>说明：关于佣金税费，网络推客按照劳务所得税扣除税点；</p>
                </div>
                <div class="text-center">
                    <el-button type="primary" @click="save(1)" v-if="type == 'edit'" :loading="loadingBtn">保存修改</el-button>
                </div>
            </el-form>
        </div>
        <!--第二个大tab 超标审核记录-->
        <div v-if="tabIndex==1">
            <!-- v2.10 -->
            <div>
                <h4 class="star">流程审批名称：</h4>
                <div>
                    {{manualProcessName}}
                </div>
                <h4 class="star">超标原因：</h4>
                <div style="word-break: break-all">{{exceedReason}}</div>
                <h4>附件:</h4>
                <Upload :multiple="true" ref="upload1" :fileList="accessories" readonly/>
            </div>
            <h4 class="star">审核记录：</h4>
            <table class="standardTab">
                <tr>
                    <td>名称</td>
                    <td>超标原因</td>
                    <td>操作</td>
                    <td>审核意见</td>

                    <td>操作人</td>
                    <td>审核时间</td>
                    <td>附件</td>
                </tr>
                <tr v-for="item in checkExeedData">
                    <td>{{item.manualProcessName}}</td>
                    <td>{{item.exceedReason}}</td>
                    <td>{{initCheckStatus(item)}}</td>
                    <td>{{item.content}}</td>

                    <td>{{item.userName}}</td>
                    <td>{{initCheckTime(item.auditTime)}}</td>
                    <td>
                        <el-button type="text"
                                   v-show="item.accessories&&item.accessories.length>0"
                                   @click="showAccessories(item)"
                        >附件查看</el-button>
                    </td>
                </tr>
            </table>
        </div>
        <el-dialog title="流程审批" :visible.sync="dialogVisible"  :append-to-body="true" width="50%" :close-on-click-modal="false" @close="closeModle">
            <!-- v2.10 -->
            <p class="commonprogress commonP">流程审批名称</p>
            <el-input v-model="form.manualProcessName" placeholder="名称" maxlength="30"></el-input>
            <p class="commonprogress commonP">超标原因说明</p>
            <el-input
                    type="textarea"
                    placeholder="超标原因说明"
                    v-model.trim="form.exceedReason"
                    maxlength="300"
                    show-word-limit
            >
            </el-input>
            <p class="commonP" style="margin-top: 25px;">上传附件</p>

            <el-button @click="uploadHandle">+</el-button>
            <input type="file" ref="inputfile" @change="fileChangeHandle" style="display: none;">
            <el-table :data="form.accessories" border stripe style="margin-top: 15px;border:none;">
                <el-table-column  prop="fileTextName" align="center"  label="文件名"></el-table-column>
                <el-table-column  prop="fileSize" align="center"  label="大小"></el-table-column>
                <el-table-column  prop="createPerson" align="center"  label="创建人"></el-table-column>
                <el-table-column  prop="uploadTime" align="center"  label="上传时间"></el-table-column>
                <el-table-column  label="操作" align="center" >
                    <template slot-scope="scope">
                        <el-button size="small" type="text" @click="delaccessory(scope.row)">删除文件</el-button>
                    </template>
                </el-table-column>
            </el-table>

            <el-button type="primary" style="margin-top:25px;" @click="submitcheck" :loading="checkBtnLoading">提交审核</el-button>
        </el-dialog>

        <!--查看附件弹窗-->
        <el-dialog title="附件" :visible.sync="accessoriesVisible"  :append-to-body="true" width="700px">
            <el-table :data="accessoriesDialog" border stripe>
                <el-table-column  prop="fileTextName" align="center"  label="文件名">
                    <template slot-scope="scope">
                        <a :href="scope.row.fileTextAddress" target="_blank">{{scope.row.fileTextName}}</a>
                    </template>
                </el-table-column>
                <el-table-column  prop="createPerson" align="center"  label="创建人"></el-table-column>
                <el-table-column  prop="uploadTime" align="center"  label="上传时间"></el-table-column>
            </el-table>
        </el-dialog>
        <cesuanDialog ref="cesuanDialog" :cesuanCopy="cesuanCopy" :checked="checked"></cesuanDialog>
    </div>
</template>

<script>
import api from "@/api/apiPath"
import Util from "@/common/utils"
import * as qiniu from 'qiniu-js'
import Upload from '@/components/common/Upload'
import cesuanDialog from './cesuanDialog'

export default {
    name:"brokerageRuleDetail",
    created() {},
    components: {Upload,cesuanDialog},
    data() {
        return {
            manualProcessName:'',//审批名称
            exceedReason:'',//超标理由
            accessories:[],//附件列表数组
            accessoriesDialog: [],// 查看附件弹窗的表格数据
            accessoriesVisible: false,
            imglist:[],
            loadingBtn:false,
            checkBtnLoading:false,
            dialogVisible:false,
            tabIndex:0,
            isExceed:"",//是否超标
            checkExeedData:[],//超标记录
            title: '',
            alpha: '一二三四五六七八九十',
            options: [
                {label: '百分比', value: 1},
                {label: '固定金额', value: 2}
            ],
            tempAwardSources:[
                {label: '前佣-经纪人分佣', value: 5},
                {label: '后佣-经纪人分佣', value: 6},
                {label: '开发商-返还款', value: 1},
                {label: '开发商-回款', value: 2},
            ],
            awardSources:[],
            awardTypes:[
                {label: '购物卡', value: 1},
                {label: '现金', value: 2}
            ],
            pickerOption:{
                disabledDate(time) {
                    return time.getTime() < Date.now()- 8.64e7;
                }
            },
            type: this.$route.query['type'],
            id: this.$route.query['id'],
            form: {
                manualProcessName:'',//超标名称
                exceedReason:"",//超标原因
                accessories:[],//超标附件
                roleList: [],
                estateIdList: [],
                brokerageType: 1,
                brokerageNode: [],
                packageStarTime: '',
                packageEndTime: '',
                formulaModel: [{
                    brokerageFormulaType: 1,
                    renovationTaxPoint: '',
                    houseMoneyTaxPoint:"",
                    formula: 1
                },{
                    brokerageFormulaType: 2,
                    renovationTaxPoint: '',
                    houseMoneyTaxPoint:"",
                    formula: 3
                }],
                formulaPackage: []
            },
            devs:[],
            rules: {
                awardSource:{
                    required: true,message: '请选择奖励来源',trigger: 'change'
                },
                awardType:{
                    required: true,message: '请选择奖励方式',trigger: 'change'
                },
                //(单个金额)
                packageAmount: {
                    validator: (rule, value, callback) => {
                        let reg = /^(\-|\+)?\d+(\.\d*)?$/;
                        if (!reg.test(value)) {
                            return callback(new Error('最多保留两位小数'));
                        }
                        callback();
                    }
                },
                //佣金比例
                brokerageProportion: {
                    required: true,
                    validator: (rule, value, callback) => {
                        value = value.toString();
                        if (!value) {
                            return callback(new Error('请填写佣金比例'));
                        }
                        let reg = /^(\-|\+)?\d+(\.\d*)?$/;
                        if (!reg.test(value)) {
                            return callback(new Error('最多保留两位小数'));
                        }
                        callback();
                    }
                },
                //金额
                brokerageAmount: {
                    required: true,
                    validator: (rule, value, callback) => {
                        value = value.toString();
                        if (!value) {
                            return callback(new Error('请填写金额'));
                        }
                        let reg = /^(-)?\d+(\.\d*)?$/;
                        if (!reg.test(value)) {
                            return callback(new Error('金额最多保留两位小数'));
                        }
                        callback();
                    }
                },

                //上限
                upperLimitAmount: {
                    type: 'number',
                    required: true,
                    validator: (rule, value, callback) => {
                        value = value.toString();
                        if (!value) {
                            return callback(new Error('请填写上限认购金额'));
                        }
                        let reg = /^\d+$/;
                        if (!reg.test(value)) {
                            return callback(new Error('上限认购金额为整数'));
                        }
                        callback();
                    }
                },

                //请填写套餐名称
                packageName: {
                    required: true, message: '请输入套餐名称'
                },
                //请填写套餐名称
                packageExplain: {
                    required: true, message: '请输入套餐说明'
                },
                packageAmountPercent:{required: true, message: '请输入金额百分比'},
                //请选择佣金节点
                goodLifeNode:{ required: true, message: '请选择佣金节点', trigger: 'change' },
            },
            cesuanCopy: {},
            checked: []
        }
    },
    methods: {
        // 查看附件按钮
        showAccessories(item){
            this.accessoriesVisible = true
            this.accessoriesDialog = JSON.parse(item.accessories)
        },
        uploadHandle () {
            const node = this.$refs.inputfile
            node.click()
        },
        fileChangeHandle () {
            const file = this.$refs.inputfile.files[0]
            // 判断文件类型
            const upType = ['jpg', 'png','jpeg','pdf','PDF']
            const fileName = file.name
            const postfix = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length)
            if (upType.indexOf(postfix) === -1) {
                alert('只支持png jpg jpeg格式的图片或PDF')
                return false
            }
            this.uploadQiniu(file)
        },
        // 用七牛上传
        uploadQiniu (file) {
            const fileName = file.name
            const postfix = fileName.substring(fileName.lastIndexOf('.'), fileName.length)
            const name = Util.getTimeString2(new Date().getTime())
            const token = this.token
            var putExtra = {
                fname: fileName,
                params: {},
                mimeType: null
            }
            var config = {
                useCdnDomain: true
            }
            var observable = qiniu.upload(file, name + postfix, token, putExtra, config)
            const vueThis = this
            this.percentShow = true
            this.percentage = 10
            observable.subscribe(function (res) {
                console.log('图片上传进度：', res)
                vueThis.percentage = res.total.percent
            }, function (error) {
                console.error('图片上传失败：', error)
            }, function (res) {
                vueThis.imgUrl = vueThis.qiniuUrl + res.key
                var fileItem={};
                fileItem.createPerson=localStorage.getItem('cmsUser')?JSON.parse(localStorage.getItem('cmsUser')).name:'';
                fileItem.fileSize=((file.size/1024)>100)?((file.size/1024/1024).toFixed(2)+"MB"):((file.size/1024).toFixed(2)+"Kb");
                fileItem.uploadTime=vueThis.getTimeString(new Date().getTime());
                fileItem.fileTextName=fileName;
                fileItem.fileTextAddress=vueThis.imgUrl;
                vueThis.form.accessories.push(fileItem);
            })
        },
        getTimeString (timestamp) {
            if (timestamp) {
                const time = new Date(timestamp)
                let dateStr = ''
                const year = time.getFullYear()
                const month = String(time.getMonth() + 1).length === 1 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1)
                const day = String(time.getDate()).length === 1 ? '0' + time.getDate() : time.getDate()
                dateStr = year + '-' + month + '-' + day
                let timeStr = ''
                const hours = time.getHours()
                const hh = String(hours).length === 1 ? '0' + hours : hours
                const minutes = time.getMinutes()
                const mm = String(minutes).length === 1 ? '0' + minutes : minutes
                const seconds = time.getSeconds()
                const ss = String(seconds).length === 1 ? '0' + seconds : seconds
                timeStr = `${hh}:${mm}:${ss}`
                // timeStr = `${hh}:${mm}`
                return dateStr + ' ' + timeStr
                // return dateStr
            } else {
                return ''
            }
        },

        delaccessory(data){
            this.$confirm('此操作将删除该文件，是否继续？',"提示",{
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(()=>{
                this.$alert("操作成功","提示",{
                    confirmButtonText: '确定',
                    type: 'warning',
                    callback:action=>{
                        for(var i=0;i<this.form.accessories.length;i++){
                            if(data.fileTextName==this.form.accessories[i].fileTextName){
                                this.form.accessories.splice(i,1);
                            }
                        }
                    }
                })
            }).catch(()=>{});
        },
        showLoading(){
            loading = this.$loading({
                lock: true,
                text: 'Loading',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
        },
        closeModle(){
            console.log("sss");
        },
        submitcheck(){
            // v2.1.0
            if (this.form.manualProcessName =="") {
                this.warn("请输入流程审批名称");
                return;
            }
            if(this.form.exceedReason==""){
                this.warn("请输入超标原因");
                return;
            }
            this.checkBtnLoading=true;
            this.save(2);
        },
        tabIndexclick(val){
            this.tabIndex=val;
        },
        awardSourcefrom(val){//判断奖励来源
            if(val==1){
                return "开发商-返还款"
            }else if(val==2){
                return "开发商-回款"
            }else if(val==5){
                return "前佣-经纪人分佣"
            }else if(val==6){
                return "后佣-经纪人分佣"
            }
        },
        awardTypeway(val){//判断奖励方式
            if(val==1){
                return "购物卡"
            }
            if(val==2){
                return "现金"
            }
        },
        roleFn(value) {
            let arr = [];
            value.forEach(it => {
                if(it == 3){
                    this.roletype=3
                    arr.push('职业经纪人');
                }else if(it==0){
                    this.roletype=0
                    arr.push('网络推客');
                } else if(it==-1){
                    this.roletype=-1
                    arr.push('自来客');
                }
            });
            return arr.join(',');
        },
        typeFn(value) {
            let obj = {
                "1": '前佣',
                "2": '后佣',
                "3": '前佣+后佣',
            };
            return obj[value];
        },

        formulaFn(value){
            let obj = {
                "1": '固定金额',
                "2": '含税成交价*佣金比例',
                "3": '含税成交价*佣金比例 +金额',
                "4": '不含税成交价*佣金比例',
                "5": '不含税成交价*佣金比例 +金额',
                "6": '建筑面积',
                "7": '套内面积',
            };
            return obj[value];
        },
        loadInfo() {
            this.axios.post(api.selectRule, {id:this.id}).then(res => {
                let {brokerage,estate} = res.data.data;
                //  佣金测算的参数
                if(estate && estate[0]){
                    this.checked = estate.map(item =>{
                        return {
                            id: item.devId,
                            name: item.cityName + '-' + item.devName
                        }
                    })
                    this.devs = estate;
                }else {
                    this.devs = []
                }


                brokerage.formulaPackage.forEach(it => {
                    it.packageModel.forEach(item => {
                        let m = item.upperLimitAmount;
                        if(m){
                            item.upperLimitAmount = m.toString();
                        }
                    })
                });
                // v2.1.0超标审核记录需要展示
                this.manualProcessName = brokerage.manualProcessName
                this.exceedReason = brokerage.exceedReason

                this.accessories = []
                if (brokerage.accessories && brokerage.accessories.length>0) {
                    brokerage.accessories.forEach((item)=>{
                        this.accessories.push(item.fileTextAddress)
                    })
                }

                brokerage.exceedReason="";
                brokerage.accessories=[];
                this.form = brokerage;

                this.isExceed=brokerage.isExceed;
                if(this.form.accessories==""){
                    this.form.accessories=[]
                }
                let newcustomeNode=[];//需要赋值的开发商节点
                let customeNode=[];//去重后的开发商节点
                for(let i=0,len=brokerage.formulaPackage.length;i<len;i++){
                    let data=brokerage.formulaPackage[i]
                    if(data.exhibitionType == ""){
                        data.exhibitionType=[1,2]
                    }
                    //开发商节点赋值
                    for(let j=0;j<data.packageModel.length;j++){
                        newcustomeNode.push({"value":data.packageModel[j].goodLifeNode,"label":data.packageModel[j].goodLifeNodeName})
                    }
                    //开发商节点去重
                    for(let m=0;m<newcustomeNode.length;m++){
                        let flag=true;
                        for(let n=0;n<customeNode.length;n++){
                            if(newcustomeNode[m].value==customeNode[n].value){
                                flag=false
                            }
                        }
                        if(flag){
                            customeNode.push(newcustomeNode[m])
                        }
                    }
                    data.customeNode=customeNode
                }


                this.checkrecord(brokerage.id);
                if(this.type=="view"){
                    this.cesuanCopy = brokerage
                }

                // 奖励来源的赋值
                if(this.form.brokerageType ==1){// 前佣
                    let temp = []
                    temp.push(this.tempAwardSources[0])
                    temp.push(this.tempAwardSources[2])
                    this.awardSources = temp
                } else if (this.form.brokerageType ==2){
                    let temp2 = [...this.tempAwardSources]
                    temp2.shift()
                    this.awardSources = temp2
                } else {
                    this.awardSources = this.tempAwardSources
                }
            });
        },
        checkrecord(ruleId){
            this.axios.post(api.auditLogs, {ruleId:ruleId}).then((res)=>{
                this.checkExeedData=res.data.data;
            }).catch((error)=>{
                console.log(error)
            })
        },
        initCheckStatus(item){
            if(item.oprationFlag==0){
                return '提交'
            }else if(item.oprationFlag==1){
                if(item.checkStatus==0){
                    return "审核中"
                } else if(item.checkStatus==1){
                    return "审核成功"
                } else if(item.checkStatus==2){
                    return "审核失败"
                }
            }
        },
        initCheckTime(timestamp){
            if (timestamp) {
                const time = new Date(timestamp)
                let dateStr = ''
                const year = time.getFullYear()
                const month = String(time.getMonth() + 1).length === 1 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1)
                const day = String(time.getDate()).length === 1 ? '0' + time.getDate() : time.getDate()
                dateStr = year + '-' + month + '-' + day
                let timeStr = ''
                const hours = time.getHours()
                const hh = String(hours).length === 1 ? '0' + hours : hours
                const minutes = time.getMinutes()
                const mm = String(minutes).length === 1 ? '0' + minutes : minutes
                const seconds = time.getSeconds()
                const ss = String(seconds).length === 1 ? '0' + seconds : seconds
                timeStr = `${hh}:${mm}:${ss}`
                // timeStr = `${hh}:${mm}`
                return dateStr + ' ' + timeStr
                // return dateStr
            } else {
                return ''
            }
        },
        changeNode(val,val1){
            let obj = {};
            obj = val.customeNode.find((item)=>{
                return item.value === val1.goodLifeNode;
            });
            val1.goodLifeNodeName=obj.label;
        },
        getUid(len, radix) {
            var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
            var uuid = [], i;
            radix = radix || chars.length;

            if (len) {
                // Compact form
                for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
            } else {
                // rfc4122, version 4 form
                var r;

                // rfc4122 requires these characters
                uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
                uuid[14] = '4';

                // Fill in random data. At i==19 set the high bits of clock sequence as
                // per rfc4122, sec. 4.1.5
                for (i = 0; i < 36; i++) {
                    if (!uuid[i]) {
                        r = 0 | Math.random()*16;
                        uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
                    }
                }
            }

            return uuid.join('');
        },
        addTc() {
            console.log(this.form.formulaPackage[0].packageModel)
            let uId=this.getUid(32,16);
            let fn = (model) => {
                model = {...model};
                let {packageFormula,packageBrokerageType} = model;
                for(let key in model){
                    if( key=="brokerageNodes"){
                        let temparr=model[key]
                        for(let i=0;i<temparr.length;i++){
                            // temparr[i].brokeNodeAmount=""
                        }
                    }else{
                        model[key] = '';
                    }
                }
                model.packageUpperLimit = 2;
                model.packageFormula = packageFormula;
                model.packageBrokerageType = packageBrokerageType;
                // model.brokerageNodes=this.form.formulaPackage[0].packageModel[0].brokerageNodes;
                return model;
            };
            let node = this.form.brokerageNode;
            let [a,b,c] = this.form.formulaPackage[0].packageModel;
            /*a = fn(a);
            if(b){
                b = fn(b);
            }*/
            console.log(this.form.formulaPackage[0].packageModel);
            let temp = {
                packageName: '',
                packageExplain: '',
                exhibitionType:[],
                id:uId,
                customeNode:this.form.formulaPackage[0].customeNode,
                // packageModel: b ? [{...fn(a)},{...fn(b)}] : [{...fn(a)}],
                packageModel: c ? [{...fn(a)},{...fn(b)},{...fn(c)}]  : b ? [{...fn(a)},{...fn(b)}] : [{...fn(a)}],
            };
            // console.log(JSON.parse(JSON.stringify(temp)));
            this.form.formulaPackage.push(JSON.parse(JSON.stringify(temp)));
            let tempform=this.form.formulaPackage;
            for(let i=0;i<tempform.length;i++){
                let tempModel=tempform[tempform.length-1].packageModel;
                for(let j=0;j<tempModel.length;j++){
                    let tempLimit=tempModel[j].brokerageNodes;
                    for(let m=0;m<tempLimit.length;m++){
                        tempLimit[m].brokeNodeAmount="";
                        if(tempLimit[m].nodeName=="认购"){
                            tempLimit[m].upperLimitAmount=""
                        }
                    }
                }
            }
        },
        del(i) {
            this.form.formulaPackage.splice(i, 1);
        },
        AmountBlur(val){
            if(val===""){
                this.warn('请输入必填项');
                return;
            }

            let reg = /^(\-|\+)?\d+(\.\d*)?$/;
            if (!reg.test(val)) {
                this.warn('限数字且最多保留两位');
                return;
            }
        },
        dedupe(array){
            return Array.from(new Set(array));
        },
        saveParams(param){
            this.axios.post(api.updateRule, param).then(res => {
                if(res.data.code == 200){
                    this.$alert('编辑成功', '提示', {
                        confirmButtonText: '确定',
                        type: 'success',
                        callback: action => {
                            this.$router.push({path: '/brokerageRuleList'})
                        }
                    });
                }else {
                    this.$alert(res.msg, '提示', {
                        type: 'error',
                        callback: action => {
                            this.loadingBtn=false;
                            this.checkBtnLoading=false;
                        }
                    });
                }
            });
        },
        //编辑
        save(val){
            this.$refs['form'].validate(valid => {
                if(valid){
                    let {brokerageNode,formulaPackage:pack} = this.form;
                    console.log(this.form);
                    if (this.form.packageStarTime > this.form.packageEndTime) {
                        this.warn('结束时间不能早于开始时间');
                        return;
                    }

                    for(let i=0,len=this.form.formulaPackage.length;i<len;i++){
                        let editForm=this.form.formulaPackage[i].packageModel;
                        let sameArr=[];//判断节点相加是否大于100%或者金额的总数
                        let sum=0;//前佣或者后佣单独出现
                        let sumFront=0;//前加后组合的前
                        let sumEnd=0;//前加后组合的后
                        let sunBro=0;//经纪人奖励
                        let openBusinessGrantPackageAmountsum=0;
                        let frontTempNode,endTempNode;
                        var tempFrontNodes,tempEndNodes,tempBrokerNodes;

                        for(var k=0;k<editForm.length;k++){
                            if(editForm.length>1){
                                if(editForm[k].packageBrokerageType==1){//前佣
                                    tempFrontNodes=editForm[k].brokerageNodes;
                                    frontTempNode=editForm[k].goodLifeNode;
                                    openBusinessGrantPackageAmountsum+=parseFloat(editForm[k].openBusinessGrantPackageAmount*(editForm[k].openBusinessGrantPercentage/100));

                                    for(let x=0;x<tempFrontNodes.length;x++){
                                        sameArr.push(tempFrontNodes[x].brokeNodeType);
                                        sameArr=this.dedupe(sameArr);
                                        if(tempFrontNodes[x].brokeNodeAmount.toString()==""){
                                            this.warn(`第${this.alpha[i]}套套餐前佣节点${x+1}不能为空`);
                                            return;
                                        }
                                        sumFront+=parseFloat(tempFrontNodes[x].brokeNodeAmount);
                                    }
                                    if(this.roletype!=-1 && sameArr.length==1){
                                        if(editForm[k].packageFormula==1){
                                            if(sameArr[0]==1){
                                                if(sumFront != 100){
                                                    this.warn(`第${this.alpha[i]}套套餐前佣节点之和必须为100%`);
                                                    return;
                                                }
                                            }
                                            if(sameArr[0]==2){
                                                if(sumFront != editForm[k].packageAmount*(parseFloat(editForm[k].brokeragePercentage)/100)){
                                                    this.warn(`第${this.alpha[i]}套套餐前佣节点之和必须为金额设置的值`);
                                                    return;
                                                }
                                            }
                                        }else{
                                            if(sameArr[0]==1){
                                                if(sumFront != 100){
                                                    this.warn(`第${this.alpha[i]}套套餐前佣节点之和必须为100%`);
                                                    return;
                                                }
                                            }
                                        }
                                    }

                                }
                                if(editForm[k].packageBrokerageType==2){//后佣
                                    tempEndNodes=editForm[k].brokerageNodes;
                                    endTempNode=editForm[k].goodLifeNode;
                                    openBusinessGrantPackageAmountsum
                                        +=parseFloat(
                                            editForm[k].openBusinessGrantPackageAmount*editForm[k].openBusinessGrantPercentage/100
                                    );
                                    let isHuiKuan = ''

                                    for(let y=0;y<tempEndNodes.length;y++){
                                        sameArr.push(tempEndNodes[y].brokeNodeType);
                                        sameArr=this.dedupe(sameArr);
                                        if(tempEndNodes[y].nodeName!="回款"){
                                            if(tempEndNodes[y].brokeNodeAmount.toString()==""){
                                                this.warn(`第${this.alpha[i]}套套餐后佣节点${y+1}不能为空`);
                                                return;
                                            }
                                        }
                                        sumEnd+=parseFloat(tempEndNodes[y].brokeNodeAmount);
                                        // 有回款节点
                                        if(tempEndNodes[y].nodeName=="回款"){
                                            isHuiKuan="回款";
                                        }

                                    }
                                    if(this.roletype!=-1 && sameArr.length==1){
                                        if(editForm[k].packageFormula==1){
                                            if(sameArr[0]==1){
                                                if(isHuiKuan=='回款'){
                                                    if(sumEnd > 100){
                                                        this.warn(`第${this.alpha[i]}套套餐后佣节点之和不能大于100%`);
                                                        return;
                                                    }
                                                }else {// 没有回款节点节点之和必须为100
                                                    if(sumEnd != 100){
                                                        this.warn(`第${this.alpha[i]}套套餐后佣节点之和必须为100%`);
                                                        return;
                                                    }
                                                }

                                            }
                                            if(sameArr[0]==2){
                                                if(sumEnd != editForm[1].packageAmount*(parseFloat(editForm[k].brokeragePercentage)/100)){
                                                    this.warn(`第${this.alpha[i]}套套餐后佣节点之和必须为金额设置的值`);
                                                    return;
                                                }
                                            }
                                        }else{
                                            if(sameArr[0]==1){
                                                if(isHuiKuan=='回款'){
                                                    if(sumEnd > 100){
                                                        this.warn(`第${this.alpha[i]}套套餐后佣节点之和不能大于100%`);
                                                        return;
                                                    }
                                                }else {// 没有回款节点节点之和必须为100
                                                    if(sumEnd != 100){
                                                        this.warn(`第${this.alpha[i]}套套餐后佣节点之和必须为100%`);
                                                        return;
                                                    }
                                                }

                                            }
                                        }
                                    }
                                }
                                /**
                                 * 经纪人奖励校验
                                 */
                                if(this.form.roleList[0]==3&&this.form.isAward==1){
                                    if(editForm[k].packageBrokerageType==3){
                                        tempBrokerNodes=editForm[k].brokerageNodes;
                                        //经纪人奖励
                                        if(editForm[k].awardSource==1){// 奖励来源：开发商-返还款
                                            if(editForm[k].goodLifeNode != editForm[k].brokerageNodes[0].brokerageNode){
                                                this.warn(`第${this.alpha[i]}套套餐奖励来源为开发商返还款时,奖励的业绩确认节点须与经纪人奖励结佣的第一个节点保持一致!`);
                                                return;
                                            }
                                            if(this.form.formulaModel[0].formula==1){
                                                if(editForm.length==2){
                                                    if(openBusinessGrantPackageAmountsum-parseFloat(editForm[k].goodLifePackageAmount)<0){
                                                        this.warn(`第${this.alpha[i]}套套餐开发商分佣之和需大于经纪人奖励总收入`);
                                                        return;
                                                    }
                                                }else{
                                                    if(openBusinessGrantPackageAmountsum-parseFloat(editForm[k].goodLifePackageAmount)<0){
                                                        this.warn(`第${this.alpha[i]}套套餐开发商分佣之和需大于经纪人奖励总收入`);
                                                        return;
                                                    }
                                                }

                                            }
                                        }
                                        if(editForm[k].awardSource==6||editForm[k].awardSource==2){// 奖励来源：后佣-经纪人分佣，开发商-回款
                                            if(editForm[k].goodLifeNode != endTempNode){
                                                this.warn(`第${this.alpha[i]}套套餐奖励来源为后佣-经纪人分佣时,奖励的业绩确认节点须与后佣的好生活总收入的业绩确认节点保持一致!`);
                                                return;
                                            }
                                        }
                                        if(editForm[k].awardSource==5){// 奖励来源：前佣-经纪人分佣
                                            if(editForm[k].goodLifeNode != frontTempNode){
                                                this.warn(`第${this.alpha[i]}套套餐奖励来源为前佣-经纪人分佣时,奖励的业绩确认节点须与前佣的好生活总收入的业绩确认节点保持一致!`);
                                                return;
                                            }
                                        }
                                        for(var h=0;h<tempBrokerNodes.length;h++){
                                            if(tempBrokerNodes[h].brokeNodeAmount.toString()==""){
                                                this.warn(`第${this.alpha[i]}套套餐经纪人奖励节点${h+1}不能为空`);
                                                return;
                                            }
                                            let reg = /^(\-|\+)?\d+(\.\d*)?$/;
                                            if(!reg.test(tempBrokerNodes[h].brokeNodeAmount)){
                                                this.warn(`第${this.alpha[i]}套套餐经纪人奖励节点${h+1}限数字最多保留两位小数`);
                                                return;
                                            }
                                            if(editForm[k].packageFormula==1){
                                                sunBro+=parseFloat(tempBrokerNodes[h].brokeNodeAmount);
                                            }
                                        }
                                        if(sunBro != editForm[k].packageAmount){
                                            this.warn(`第${this.alpha[i]}套套餐经纪人奖励节点之和需等于金额设置的值`);
                                            return;
                                        }
                                        if(parseFloat(editForm[k].goodLifePackageAmount)
                                            != parseFloat(editForm[k].packageAmount)
                                            +parseFloat(editForm[k].goodLifeGrantPackageAmount)
                                            +parseFloat(editForm[k].openBusinessGrantPackageAmount)
                                        ){
                                            this.warn(`第${this.alpha[i]}套套餐，经纪人奖励合计≠经纪人奖励+好生活分佣+开发商分佣`);
                                            return;
                                        }
                                    }
                                }
                            }else{
                                let tempNodes=editForm[0].brokerageNodes;
                                let isHuiKuan = ''
                                for(let x=0;x<tempNodes.length;x++){
                                    sameArr.push(tempNodes[x].brokeNodeType);
                                    sameArr=this.dedupe(sameArr);
                                    if(tempNodes[x].nodeName != "回款"){
                                        if(tempNodes[x].brokeNodeAmount.toString()==""){
                                            this.warn(`第${this.alpha[i]}套套餐节点${x+1}不能为空`);
                                            return;
                                        }
                                    }else{
                                        isHuiKuan="回款"
                                    }
                                    sum+=parseFloat(tempNodes[x].brokeNodeAmount);
                                }

                                if(this.roletype!=-1 && sameArr.length==1){
                                    if(this.form.formulaModel[0].formula==1){
                                        if(sameArr[0]==1){
                                            if(isHuiKuan=="回款"){
                                                if(sum > 100){
                                                    this.warn(`第${this.alpha[i]}套套餐节点之和不能大于100%`);
                                                    return;
                                                }
                                            }else{
                                                if(sum != 100){
                                                    this.warn(`第${this.alpha[i]}套套餐节点之和必须为100%`);
                                                    return;
                                                }
                                            }
                                        }
                                        if(sameArr[0]==2){
                                            if(sum>(editForm[0].packageAmount*parseFloat(parseFloat(editForm[k].brokeragePercentage)/100))){
                                                this.warn(`第${this.alpha[i]}套套餐节点之和不能大于金额设置的值`);
                                                return;
                                            }
                                        }
                                    }else{
                                        if(sameArr[0]==1){
                                            if(isHuiKuan=="回款"){
                                                if(sum > 100){
                                                    this.warn(`第${this.alpha[i]}套套餐节点之和小于等于100%`);
                                                    return;
                                                }
                                            }else{
                                                if(sum != 100){
                                                    this.warn(`第${this.alpha[i]}套套餐节点之和必须为100%`);
                                                    return;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if(val==3){// 佣金测算
                        this.$refs.cesuanDialog.showDialog()
                        this.cesuanCopy = this.form
                    }
                    if(val==1){
                        this.loadingBtn=true;
                        this.axios.post(api.checkRule, this.form).then(res => {
                            if (res.data.code === 200) {
                                if(res.data.data){
                                    this.$alert('佣金套餐设置不符合佣金结算标准,须走流程审批!', '提示', {
                                        confirmButtonText: '确定',
                                        type: 'warning',
                                        callback: action => {
                                            this.form.manualProcessName =''
                                            this.loadingBtn=false;
                                            this.dialogVisible=true;
                                            this.checkBtnLoading=false;
                                        }
                                    });
                                }else if(res.data.data==null){
                                    this.$alert(res.data.msg, '提示', {
                                        confirmButtonText: '确定',
                                        type: 'warning',
                                        callback: action => {
                                            this.form.manualProcessName =''
                                            this.loadingBtn=false;
                                            this.dialogVisible=true;
                                            this.checkBtnLoading=false;
                                        }
                                    });
                                }else{
                                    this.saveParams(this.form);
                                }
                            } else {
                                this.$alert(res.msg, '提示', {
                                    type: 'error',
                                    callback: action => {

                                    }
                                });
                            }
                        }).catch(err=>{
                            this.loadingBtn=0;
                        })
                    }
                    if(val==2){
                        this.saveParams(this.form);
                    }

                }
            });
        },
        //生成公式
        hehe(type, formula, pack) {
            let mime = {
                '1': `${pack.goodLifePackageAmount}`,
                '2': `【含税成交价 * ${pack.goodLifeProportion}%】`,
                '3': `【含税成交价 * ${pack.goodLifeProportion}%${pack.goodLifeAmount < 0 ? '' : ' + '}${pack.goodLifeAmount}】`,
                '4': `【不含税成交价 * ${pack.goodLifeProportion}%】`,
                '5': `【不含税成交价 * ${pack.goodLifeProportion}%${pack.goodLifeAmount < 0 ? '' : ' + '}${pack.goodLifeAmount}】`,
                '6': `${pack.goodLifePackageAmount}`,
                '7': `${pack.goodLifePackageAmount}`,
            };
            if(formula==6||formula==7){
                return mime[formula] + '元/平米'+`*${pack.goodLifePercentage}%`;
            }

            return mime[formula] + '元/套'+`*${pack.goodLifePercentage}%`;
        },
        warn(msg) {
            this.$alert(msg, '提示', {
                type: 'error',
                confirmButtonText: '确定',
            });
        },
        clear(val,index,i){
            if(val == 2){
                // this.form.formulaPackage[index].packageModel[i].upperLimitAmount = '';
                var tempupperlimt=this.form.formulaPackage[index].packageModel[i];
                console.log(tempupperlimt)
                for(var j=0;j<tempupperlimt.brokerageNodes.length;j++){
                    if(tempupperlimt.brokerageNodes[j].nodeName=="认购"){
                        tempupperlimt.brokerageNodes[j].upperLimitAmount=""
                    }
                }
            }

        }
    },
    computed: {
        allDev(){
            if(this.devs.length>0){
                return this.devs.map(it => {
                    return `${it.cityName}--${it.devName}`
                }).join(',');
            }else {
                return '全部楼盘'
            }
        },
        is(){
            // return this.form.brokerageType == 2 ? 0 : 1;
            if(this.form.brokerageType == 1 || this.form.brokerageType == 2){
                return 0
            }else{
                return 1
            }
        }
    },
    mounted(){
        if(this.type == 'edit'){
            this.title = '佣金规则编辑';
        }else {
            this.title = '佣金规则查看';
        }
        this.loadInfo();
        this.axios.post(api.UPLOADTOKEN, {}).then(res => {
            this.token = res.data.data.imgToken
            this.qiniuUrl = res.data.data.qiniuUrl
        })
    }
}
</script>
<style lang="stylus">
    .brokerageRuleDetail {
        .pageTitle{
            position: relative;
            .cesuan{
                position: absolute;
                right: 60px;
                top: -20px;
                cursor: pointer;
                .cesuan-img{
                    text-align: center;
                }
            }
        }
        .text-center{
            text-align: center;
        }
        hr {
            margin-top: 20px;
            margin-bottom: 20px;
            border: 0;
            border-top: 1px solid #ccc;
        }
        ul {
            line-height: 30px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            border: none;
        }
        td{
            border: 1px #ccc solid;
        }

        p {
            line-height: 30px;
        }

        td.title {
            text-align: center;
        }

        td.content {
            padding-left: 100px;
            padding-top: 10px;
        }

        .pad {
            padding-left: 30px;
        }
        .pad1 {
            padding-left: 10px;
        }

        .mar {
            margin-right: 30px;
        }

        .grey {
            color: #ccc;
        }

        .red {
            color: #ff0000;
        }
        .hint{background: #f2f2f2;color: #999999;padding: 10px 10px 0;}
        .el-form-item{
            margin-bottom: 22px !important;
        }
        .radios .el-radio-group{margin-top: 13px;}
        .clear {
            display: block;
            overflow: hidden;
        }
        .clear .el-form-item:nth-of-type(2) .el-form-item__label{
            width:50px !important;
        }
        .clear .el-form-item:nth-of-type(2) .el-form-item__label:before{
            content:"" !important;
        }
        .clear .el-form-item:nth-of-type(2) .el-form-item__content{
            margin-left: 50px !important;
        }
        .clearthat .el-form-item:nth-of-type(2) .el-form-item__label{
            width:150px !important;
        }
        .clearthat .el-form-item:nth-of-type(2) .el-form-item__label:before{
            content:"*" !important;
        }
        .clearthat .el-form-item:nth-of-type(2) .el-form-item__content{
            margin-left: 150px !important;
        }
        .clearthis{
            clear: both;
            display: block;
            overflow: hidden;
        }
        .returnBroke:before{
            content: '*';
            color: #f56c6c;
            margin-right: 4px;
        }
        .clearX>label{
            width: 45px !important;
        }
        .clearX>.el-form-item__content{
            margin-left: 45px !important;
        }
        .clearX>label::before{
            content: '' !important;
            color: #f56c6c;
            margin-right: 4px;
        }
        .commonclass .el-form-item__label:before{
            content: '*';
            color: #f56c6c;
            margin-right: 4px;
        }
        .tabLook span{
            border:1px solid #ccc;
            padding: 5px 10px;
            cursor: pointer;
        }
        .tabLook span.active{
            background: rgba(26, 188, 156, 1);
            color: #fff;
            border-color:rgba(26, 188, 156, 1);
        }
        .standardTab{
            margin-top: 30px;
            border-bottom: 1px solid #ccc;
            border-left: 1px solid #ccc;
        }
        .standardTab td{
            text-align: center;
            height: 38px;
            line-height: 38px;
            border-top: 1px solid #ccc;
            border-right: 1px solid #ccc;
        }
        .commonprogress:before{
            content: '*';
            color: #f56c6c;
            margin-right: 4px;
        }
        .star:before{
            content: '*';
            color: red;
            margin-right: 3px;
        }

    }
</style>
